<html>
    <head>
        <meta charset="utf-8" />
        <title>js调用click</title>
        
        <script type="text/javascript">
            function onalert() {
                alert("test alert");
            }
        </script>
    </head>
    
    <body >
        <p><a id="alert" onclick="onalert()">alert</a></p>
    </body>
</html>